<?php

/**
 * ContactForm class.
 * ContactForm is the data structure for keeping
 * contact form data. It is used by the 'contact' action of 'SiteController'.
 */
class UserOptionForm extends CFormModel
{
	public $id_user;
	public $wiki_help;
	public $language;
	public $pagination;
	public $restrict_ips;
	public $allow_reset_restrict_ip_byemail;

	/**
	 * Declares the validation rules.
	 */
	public function rules()
	{
		return array(
		);
	}

	/**
	 * Declares customized attribute labels.
	 * If not declared here, an attribute would have a label that is
	 * the same as its name with the first letter in upper case.
	 */
	public function attributeLabels()
	{
		return array(
			'wiki_help' => 'Wiki Help Link',
			'language' => 'Language',
			'pagination' => 'Pagination Limit',
			'restrict_ips' => 'Restrict Access By IP',
			'allow_reset_restrict_ip_byemail' => 'Allow reset IP restriction by email'
		);
	}
	
	public function getFieldLabel($field)
	{
		$labels = $this->attributeLabels();
		
		return empty($labels[$field])? '' : $labels[$field];
	}
	
	public function wikiDatasource()
	{
		return array(
			IndividualConfig::WIKI_ENABLED => 'Enabled',
			IndividualConfig::WIKI_DISABLED => 'Disabled'
		);
	}
	
	public function languageDatasource()
	{
		return array(
			IndividualConfig::LANGUAGE_EN => 'English',
			IndividualConfig::LANGUAGE_ESP => 'Español',
			IndividualConfig::LANGUAGE_LE => 'Le Français',
			IndividualConfig::LANGUAGE_DEU => 'Deutsch'
		);
	}

	public function paginationDatasource()
	{
		return array(
			'5' => 5,
			'10' => 10,
			'25' => 25,
			'50' => 50,
			'100' => 100,
		);
	}
	
}